package com.pure.common.lambda.showtime;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @description: distinct
 * @date: 2022-06-08 09:36
 * @since 1.2.0
 **/
@Slf4j
public class LambdaDistinctLearn {

    public static void main(String[] args) {

        List<String> list = new ArrayList<>();
        list.add("zhangsan");
        list.add("lishihua");
        list.add("lishihua");
        list.add("lishihua");
        list.add("lishihua");
        list.add("lishihua");
        list.add("wanghao");
        list.add("");
        list.add(null);
        list.add("lizhengding");

        List<String> distinctList = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());

        log.info("list distinct is {}", distinctList);

    }

}
